<template>
  <view class="wrap">
    <ad :adpid="adId[0]" @load="onload" @close="onclose" @error="onerror"></ad>
  </view>
</template>

<script>

export default {
  data() {
    return {
      adId: []
    }
  },
  onLoad(opition) {
    let _this = this
    uni.getSystemInfo({
      success: function (res) {
        if (res.platform == 'android') {
          _this.adId = [
            '1459449445',
            '1387520600'
          ]
        } else {
          _this.adId = [
            '1558764981',
            '1259245595'
          ]
        }
      }
    });

    console.log(this.adId)
  },

  methods: {
    onload1(e) {
      console.log("onload");
    },
    onclose1(e) {
      console.log("onclose: " + e.detail);
    },
    onerror1(e) {
      console.log("onerror: " + e.detail.errCode + " message:: " + e.detail.errMsg);
    },


    onload(e) {
      console.log("onload");
    },
    onclose(e) {
      console.log("onclose: " + e.detail);
    },
    onerror(e) {
      console.log("onerror: " + e.detail.errCode + " message:: " + e.detail.errMsg);
    },
  }
}
</script>


